package com.duyutian.zhanglong.p7客户端和服务端连接;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

/**
 * @Author : duyutian
 * @Date : 2019/11/20 20:13
 * @Version 1.0
 */
public class MyClient {
    public static void main(String[] args) throws InterruptedException {
        NioEventLoopGroup eventGroup = new NioEventLoopGroup();
        try {
            Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(eventGroup)
                    .channel(NioSocketChannel.class)
                    .handler(new MyClientInitializer());
            ChannelFuture localhost = bootstrap.connect("localhost", 8089)
                    .sync();
            localhost.channel().closeFuture().sync();
        } finally {
            eventGroup.shutdownGracefully();
        }


    }
}
